﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Excellent
{
    public partial class StudentlistForm : Form
    {
        public StudentlistForm()
        {
            InitializeComponent();
        }

        DataSet ds  ;
        private void StudentlistForm_Load(object sender, EventArgs e)
        {
            string sql = string.Format(@"select * from StudentUsers a,T_gacct b where  a.gradeid=b.gradeid");
            ds = DBHelper.GetDataSet(sql);
            this.dgvSlist .AutoGenerateColumns = false;
            this.dgvSlist .DataSource = ds.Tables[0];
        }

        private void btSelect_Click(object sender, EventArgs e)
        {
            string grade =this.cBgrade.Text;

            //创建视图 DataView
            DataView dv = new DataView(ds.Tables[0]);
            //根据数据name去DataView查找筛选（RowFilter）
            dv.RowFilter = string.Format("grade like '%{0}%'", grade);
            //将筛选出来的数据放回 dataGridView中
            this.dgvSlist .DataSource = dv; 
        }

    
    }
}
